﻿using System;
using System.IO;

namespace MoveDgnToPath
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入目录：");
            string filePath = Console.ReadLine();
            DirectoryInfo directoryInfo = new DirectoryInfo(filePath);
            FileInfo[] fileInfos = directoryInfo.GetFiles();
            foreach (FileInfo info in fileInfos)
            {
                string extension = info.Extension.ToLower();
                if (extension == ".dgn")
                {
                    string newDgnPath = info.DirectoryName + Path.DirectorySeparatorChar + info.Name.Substring(0, 13);
                    if (!Directory.Exists(newDgnPath))

                    {

                        Directory.CreateDirectory(newDgnPath);

                    }
                    info.MoveTo(newDgnPath + Path.DirectorySeparatorChar + info.Name);


                }

            }
        }
    }
}
